package com.example.maple.ccsclient.view;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.Display;
import android.view.View;

import com.example.maple.ccsclient.utils.DisplayUtils;

/**
 * 设置RecyclerView Item之间的艰巨间距
 * Created by maple on 2016/7/24.
 */
public class SpaceItemDecoration extends RecyclerView.ItemDecoration{

	private final int mSpace;

	public SpaceItemDecoration(Context context, int space) {
		this.mSpace = DisplayUtils.px2dip(context,space);
	}

	@Override
	public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {

		int pos = parent.getChildAdapterPosition(view);
		outRect.bottom = mSpace;

	}
}
